﻿using System;
using System.Web;

namespace Utils
{
    public class SessionHelper
    {        
        public static string GetSession(string name)
        {
            string SessionValue = string.Empty;
            if (HttpContext.Current.Session[name] != null)
            {
                try
                {
                    SessionValue = HttpContext.Current.Session[name].ToString();
                }
                catch { }
            }
            return SessionValue;
        }

        public static void SetSession(string name, string value)
        {
            var iSessionExpires = 60 * 1; // mặc định
            try
            {
                iSessionExpires = Convert.ToInt32(Config.Global.Settings.COOKIE_EXPIRES);
            }
            catch { }

            HttpContext.Current.Session.Timeout = iSessionExpires;            
            HttpContext.Current.Session[name] = value;
            
        }

    }
}
